<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge,chrome=1">
    <meta name="author" content="梅子">
    <title></title>
<style>
     body{
         margin: 0;
     }
     .box{
            width: 520px;
            height: 280px;
            margin: 100px auto;
            position: relative;
        }
        ul{
            margin: 0;
            padding: 0;
            list-style: none;
        }
        li{
            position: absolute;
            display: none;
        }
        li.current{
            display: block;
        }
        .yuan{
            width: 130px;
            height: 20px;
            line-height: 20px;
            border: 1px solid white;
            border-radius: 20px;
           font-size: 25px;
           text-align: center;
           position: relative;
           opacity: 0.6;
           left:1000px;
           top:-100px;
        }
        span{
            color:white;
        }
        .red{
            color: red;
        }
</style>
</head>
<body>
      <div class="box">
          <ul>
              <li class="current"><a href="#"><img src="1.jpg" alt=""></a></li>
          </ul>
          <ul>
              <li><a href="#"><img src="2.jpg" alt=""></a></li>
          </ul>
          <ul>
              <li><a href="#"><img src="3.jpg" alt=""></a></li>
          </ul>
          <ul>
              <li><a href="#"><img src="4.jpg" alt=""></a></li>
          </ul>
          <ul>
              <li><a href="#"><img src="5.jpg" alt=""></a></li>
          </ul>
          
      </div>
      <div class="yuan">
              <span class="red">●</span>
              <span >●</span>
              <span>●</span>
              <span>●</span>
              <span>●</span>
          </div>
</body>
</html>
<script>
        var lis=document.querySelectorAll('li');
        var spans=document.querySelectorAll('span');
        var imgs=document.querySelectorAll('img')
        var t=setInterval(changeImage,2000)
        var index=0;
        function changeImage(){
            for(var i=0;i<lis.length;i++){
                lis[i].className='';
                spans[i].className='';
                
            }
            index++;
            if(index==5){
               index=0;
            }
             lis[index].className='current';
             spans[index].className='red';
        }
        for(var i=0;i<imgs.length;i++){
            imgs[i].index=i;
            imgs[i].onmouseover=function(){
                 (!imgs[i]).style.display='none';
            }
            // imgs[i].onmouseout=function(){

            // }
        }
         
        
        

</script>